Skip to content

Conversation

@Michael137
Copy link

Cherry-picked from llvm#143860 with an additional test

rdar://152113525

@Michael137 Michael137 requested a review from adrian-prantl June 12, 2025 09:15
@Michael137 Michael137 requested a review from a team as a code owner June 12, 2025 09:15
@Michael137
Copy link
Author

@swift-ci test

@Michael137 Michael137 force-pushed the lldb/memory-find-swift-to-6.2 branch from 6f2f79e to 829f40a Compare June 12, 2025 09:16
@Michael137
Copy link
Author

@swift-ci test

@Michael137 Michael137 force-pushed the lldb/memory-find-swift-to-6.2 branch from 829f40a to e4d4d6b Compare June 12, 2025 10:24
@Michael137
Copy link
Author

@swift-ci test

…helpers (llvm#143686)

This patch factors out the `-e` option logic into two helper functions.
The `EvaluateExpression` helper might seem redundant but I'll be adding
to it in a follow-up patch to fix an issue when running `memory find -e`
for Swift targets.

Also adds test coverage for the error cases that were previously
untested.

rdar://152113525
(cherry picked from commit 1c1df94)
This adds tests for:
* llvm#143686
* llvm#143860

rdar://152113525
(cherry picked from commit 276cb9d)
@Michael137 Michael137 force-pushed the lldb/memory-find-swift-to-6.2 branch from e4d4d6b to fbfa805 Compare June 12, 2025 16:14
(depends on llvm#143686)

There were two issues previously preventing `memory find -e` expressions
to succeed when stopped in Swift frames:
1. We weren't getting the dynamic type of the result `ValueObject`.
   For Swift this would fail when we tried to produce a scalar value
   out of it because the static VO wasn't sufficient to get to the
integer value. Hence we add a call to
`GetQualifiedRepresentationIfAvailable`
(which is what we do for expressions in `OptionArgParser::ToAddress`
too).
2. We weren't passing an `ExecutionContextScope` to `GetByteSize`, which
   Swift relied on to get the size of the result type.

My plan is to add an API test for this on the Apple
`swiftlang/llvm-project` fork.

I considered an alternative where we use `OptionArgParser::ToAddress`
for `memory find -e` expressions, but it got a bit icky when trying to
figure out how many bytes we should copy out of the result into the
`DataBufferHeap` (currently we rely on the size of the result variable
type). This gets even trickier when we were to pass an expression that
was actually a hex digit or a number into `ToAddress`.

rdar://152113525
(cherry picked from commit c6da2c8)
@Michael137
Copy link
Author

@swift-ci test

@adrian-prantl adrian-prantl merged commit 8473b63 into swift/release/6.2 Jun 12, 2025
3 checks passed
@adrian-prantl adrian-prantl deleted the lldb/memory-find-swift-to-6.2 branch June 12, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants